﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Tailoring
{
    public partial class frmmainmdi : Form
    {
        string a;

        public string A
        {
            get { return a; }
            set { a = value; }
        }

        
        private int childFormNumber = 0;

        public frmmainmdi()
        {
            InitializeComponent();
        }

        private void ShowNewForm(object sender, EventArgs e)
        {
           
        }

        private void OpenFile(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            openFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
            if (openFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                string FileName = openFileDialog.FileName;
            }
        }

        private void SaveAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();
            saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            saveFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
            if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                string FileName = saveFileDialog.FileName;
            }
        }

        private void ExitToolsStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void CutToolStripMenuItem_Click(object sender, EventArgs e)
        {
        }

        private void CopyToolStripMenuItem_Click(object sender, EventArgs e)
        {
        }

        private void PasteToolStripMenuItem_Click(object sender, EventArgs e)
        {
        }

        //private void ToolBarToolStripMenuItem_Click(object sender, EventArgs e)
        //{
        //    toolStrip.Visible = toolBarToolStripMenuItem.Checked;
        //}

        private void StatusBarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            statusStrip.Visible = statusBarToolStripMenuItem.Checked;
        }

        private void CascadeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.Cascade);
        }

        private void TileVerticalToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.TileVertical);
        }

        private void TileHorizontalToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.TileHorizontal);
        }

        private void ArrangeIconsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.ArrangeIcons);
        }

        private void CloseAllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form childForm in MdiChildren)
            {
                childForm.Close();
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            frmcus customer = new frmcus();
            customer.MdiParent = this;
            customer.Show();

        }

        private void button2_Click(object sender, EventArgs e)
        {
            searchdialog sd = new searchdialog();
            sd.ShowDialog();
            frmentry entry = new frmentry();
            entry.MdiParent = this;
            entry.Show();

        }

        private void button3_Click(object sender, EventArgs e)
        {
            frmorder order = new frmorder();
            order.MdiParent = this;
            order.Show();

        }

        private void customerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            searchdialog sd = new searchdialog();
            sd.ShowDialog();

             frmcus customer = new frmcus();
             customer.MdiParent = this;
            customer.Show();
        }

        private void orderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmorder order = new frmorder();
            order.MdiParent = this;
            order.Show();
        }

        private void entryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmentry entry = new frmentry();
            entry.MdiParent = this;
            entry.Show();
        }

        private void exitToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            this.Close();

        }
        public void login()
    {
       

    }       
        private void frmmainmdi_Load(object sender, EventArgs e)
        {
            frmLogon frmlogin = new frmLogon();
            ////login.MdiParent = this;
            frmlogin.ShowDialog();
            
            if (frmlogin.login())
            {
                toolsMenu.Enabled = true;
                fileMenu.Enabled = true;
                viewMenu.Enabled = true;
                logOutToolStripMenuItem.Enabled = true;
                logInToolStripMenuItem1.Enabled = false;
                mdistrip strip = new mdistrip();
                strip.MdiParent = this;

                strip.Show();
            }
            
        }

        private void mainToolStripMenuItem_Click(object sender, EventArgs e)
        {
            mdistrip strip = new mdistrip();
            strip.MdiParent = this;

            strip.Show();
        }

        private void cascadeToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            this.LayoutMdi(MdiLayout.Cascade);
        }

        private void arrangeIconsToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            this.LayoutMdi(MdiLayout.ArrangeIcons);
        }

        private void titleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.LayoutMdi(MdiLayout.TileHorizontal);
        }

        private void tileVerticalToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            this.LayoutMdi(MdiLayout.TileVertical);
        }

        private void invoiceHistoryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            InvoiceHistoryGrid invoiceh = new InvoiceHistoryGrid();
            invoiceh.MdiParent = this;
            invoiceh.Show();
        }

 

        private void logOutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                ActiveMdiChild.Close();
                
            }
            catch { }
            toolsMenu.Enabled = false;
            fileMenu.Enabled = false;
            viewMenu.Enabled = false;
            logOutToolStripMenuItem.Enabled = false;

            logInToolStripMenuItem1.Enabled = true;
        }

        private void closeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void frmmainmdi_FormClosing(object sender, FormClosingEventArgs e)
        {
            
        }

        private void enterSuitPriceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmusercontrol sett = new frmusercontrol();
            sett.tabcontrol.SelectedIndex = 1;
            sett.Show();
        }
    }
}
